﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ParkingLot.Utility.Compare
{
    /// <summary>
    /// byte[] 的比较器
    /// </summary>
    public class ByteArrayCompare : IEqualityComparer<byte []>
    {
        public bool Equals(byte[] x, byte[] y)
        {
            if (x.Length != y.Length)
            {
                return false;
            }

            for (int i = 0; i < x.Length; i++)
            {
                if (x[i]!= y[i])
                {
                    return false;
                }
            }
            return true;
        }

        public int GetHashCode(byte[] obj)
        {
           return obj.Length;
        }
    }
}
